package com.yoso.file.sdk.upload;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.RandomUtil;

import java.io.File;

public abstract class AbstractUploadFile implements UploadFile {

    /**
     * 获取随机路径：日期 + 6位随机字符
     *
     * @return {@link String }
     * @author shizejin
     * @date 2024/12/24
     */
    public String generateRandomPath() {
        return File.separator + DateUtil.today() + File.separator +  RandomUtil.randomString(6);
    }

    /**
     * 生成文件id
     *
     * @return {@link String }
     * @author shizejin
     * @date 2024/12/24
     */
    public String generateFileId() {
        return UUID.fastUUID().toString(true);
    }
}
